<cfif Not IsDefined("session.id")>
		<cflocation url = "/ecada/" addToken = "no">
</cfif>
	
<cfif IsDefined("session.experiment")>
	<cfset experiment = session.experiment>
<cfelse>
	<cflocation url="/ecada/"  addToken = "no">
</cfif>

<cfif IsDefined("form.Description") AND IsDefined("form.Title")AND IsDefined("form.CondID")>
	<cftransaction>
		<cfquery datasource="exp">
			UPDATE conditions
			SET Title =  <cfqueryparam value="#form.Title#" cfsqltype="CF_SQL_VARCHAR">
			WHERE id =  <cfqueryparam value="#form.CondID#" cfsqltype="CF_SQL_Integer">
		</cfquery>
		<cfquery datasource="exp">
			UPDATE conditions
			SET Description =  <cfqueryparam value="#form.Description#" cfsqltype="CF_SQL_VARCHAR">
			WHERE id = <cfqueryparam value="#form.CondID#" cfsqltype="CF_SQL_Integer">
		</cfquery>
	</cftransaction>
	<cfset session.message="Condition succesffuly updated!">
	<cflocation url="./../"  addToken = "no">
<cfelse>
	<cfif Not IsDefined("CondID")>
		<cfset session.message="Unknown Condition ID!">
		<cflocation url="./../" addToken = "no">
	</cfif>
	<cfquery datasource="exp" name="condition">
		SELECT *
		FROM conditions
		WHERE id = #CondID#
	</cfquery>
	
	<cfinclude template= "/ecada/header.cfm">
	<cfoutput>
		<form method="post" action="./">
			<input type="hidden" name="CondID" id="CondID" value="#HTMLEditFormat(CondID)#">
			
			<table>
				<tr>
					<td>
						Title
					</td>
					<td>
						<input type="textbox" name="Title" id="Title" value="#HTMLEditFormat(condition.Title)#">
					</td>
				</tr>
				<tr>
					<td>
						Description
					</td>
					<td>
						<input type="textbox" name="Description" id="Description" value="#HTMLEditFormat(condition.Description)#">
					</td>
				</tr>
				<tr>
					<td>
						<input type="submit">
					</td>
				</tr>
			</table>
		</form>
	</cfoutput>
	<cfinclude template= "/ecada/footer.cfm">
</cfif>



